/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * CadastroCliente.java
 *
 * Created on 05/04/2011, 00:13:55
 */
package Tela;

import Classe.BD;
import Classe.Bairro;
import Classe.Cidade;
import Classe.Cliente;
import Classe.Endereco;
import Classe.Estado;
import Classe.Validacao;
import java.awt.Component;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Date;
import java.text.SimpleDateFormat;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFrame;
import javax.swing.JOptionPane;

/**
 *
 * @author gladson
 */
public class CadastroCliente extends Validacao {

    Cliente cli = new Cliente();
    private Component frameI;

    /** Creates new form CadastroCliente */
    public CadastroCliente() throws SQLException {
        initComponents();
        this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
        iniciar();// chamando o metodo inicializar para carregar o combobox estado
    }
    String selTipo;

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        GrupoTipoCliente = new javax.swing.ButtonGroup();
        jPanel2 = new javax.swing.JPanel();
        jpnCadastroCliente = new javax.swing.JPanel();
        jpnPessoalCliente = new javax.swing.JPanel();
        lblDataNascCliente = new javax.swing.JLabel();
        lblCpfCliente = new javax.swing.JLabel();
        stxtRgCli = new javax.swing.JTextField();
        lblNomeCliente = new javax.swing.JLabel();
        lblRgCliente = new javax.swing.JLabel();
        lblTelefoneCliente = new javax.swing.JLabel();
        lblCelularCliente = new javax.swing.JLabel();
        lblEmailCliente = new javax.swing.JLabel();
        stxtEmailCli = new javax.swing.JTextField();
        stxtNomeCli = new javax.swing.JTextField();
        stxtCpfCli = new javax.swing.JFormattedTextField();
        stxtDataNascCli = new javax.swing.JFormattedTextField();
        stxtTelCli = new javax.swing.JFormattedTextField();
        stxtCelCli = new javax.swing.JFormattedTextField();
        lblMensagemPessoal = new javax.swing.JLabel();
        jpnEnderecoCliente = new javax.swing.JPanel();
        lblCepCliente = new javax.swing.JLabel();
        lblEstadoCliente = new javax.swing.JLabel();
        lblCidadeCliente = new javax.swing.JLabel();
        cbCidade = new javax.swing.JComboBox();
        lblBairroCliente = new javax.swing.JLabel();
        cbBairro = new javax.swing.JComboBox();
        lblRuaAvCliente = new javax.swing.JLabel();
        cbEndereco = new javax.swing.JComboBox();
        lblNumeroCliente = new javax.swing.JLabel();
        ItxtNumCli = new javax.swing.JTextField();
        lblComplementoCliente = new javax.swing.JLabel();
        cbEstado = new javax.swing.JComboBox();
        stxtApCli = new javax.swing.JTextField();
        stxtCompCli = new javax.swing.JComboBox();
        cbCep = new javax.swing.JFormattedTextField();
        lblMensagemEndereco = new javax.swing.JLabel();
        lblComplementoCliente1 = new javax.swing.JLabel();
        jpnTipoCliente = new javax.swing.JPanel();
        StxtBomCli = new javax.swing.JRadioButton();
        StxtRegCli = new javax.swing.JRadioButton();
        stxtRuimCli = new javax.swing.JRadioButton();
        lblDataCliente = new javax.swing.JLabel();
        txtDataCadastroCliente = new javax.swing.JTextField();
        btSalvarCli = new javax.swing.JButton();
        btLimparCli = new javax.swing.JButton();
        jPanel1 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        stxtObsCli = new javax.swing.JTextArea();
        jPanel45 = new javax.swing.JPanel();
        btCadasVeiCli = new javax.swing.JButton();
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setResizable(false);

        jPanel2.setBackground(new java.awt.Color(255, 255, 255));

        jpnCadastroCliente.setBackground(new java.awt.Color(255, 255, 255));
        jpnCadastroCliente.setBorder(javax.swing.BorderFactory.createTitledBorder(null, " Cadastro Cliente ", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("PMingLiU", 0, 36))); // NOI18N
        jpnCadastroCliente.setPreferredSize(new java.awt.Dimension(800, 600));

        jpnPessoalCliente.setBackground(new java.awt.Color(255, 255, 255));
        jpnPessoalCliente.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Pessoal", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Arial", 1, 12))); // NOI18N
        jpnPessoalCliente.setFont(new java.awt.Font("Arial", 1, 12));

        lblDataNascCliente.setFont(new java.awt.Font("Arial", 1, 11));
        lblDataNascCliente.setText("Data Nasc.");

        lblCpfCliente.setFont(new java.awt.Font("Arial", 1, 11));
        lblCpfCliente.setText("CPF ");

        stxtRgCli.setFont(new java.awt.Font("Arial", 0, 12));
        stxtRgCli.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));

        lblNomeCliente.setBackground(new java.awt.Color(204, 204, 204));
        lblNomeCliente.setFont(new java.awt.Font("Arial", 1, 11));
        lblNomeCliente.setText("Nome ");

        lblRgCliente.setFont(new java.awt.Font("Arial", 1, 11));
        lblRgCliente.setText("RG ");

        lblTelefoneCliente.setFont(new java.awt.Font("Arial", 1, 11));
        lblTelefoneCliente.setText("Telefone ");

        lblCelularCliente.setFont(new java.awt.Font("Arial", 1, 11));
        lblCelularCliente.setText("Celular");

        lblEmailCliente.setFont(new java.awt.Font("Arial", 1, 11));
        lblEmailCliente.setText("E-mail");

        stxtEmailCli.setFont(new java.awt.Font("Arial", 0, 12));
        stxtEmailCli.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));

        stxtNomeCli.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));

        stxtCpfCli.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        try {
            stxtCpfCli.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("###.###.###-##")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        stxtCpfCli.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                stxtCpfCliActionPerformed(evt);
            }
        });

        stxtDataNascCli.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        try {
            stxtDataNascCli.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("##/##/####")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }

        stxtTelCli.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        try {
            stxtTelCli.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("(##)####-####")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }

        stxtCelCli.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        try {
            stxtCelCli.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("(##)####-####")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }

        javax.swing.GroupLayout jpnPessoalClienteLayout = new javax.swing.GroupLayout(jpnPessoalCliente);
        jpnPessoalCliente.setLayout(jpnPessoalClienteLayout);
        jpnPessoalClienteLayout.setHorizontalGroup(
            jpnPessoalClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpnPessoalClienteLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jpnPessoalClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jpnPessoalClienteLayout.createSequentialGroup()
                        .addGroup(jpnPessoalClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblTelefoneCliente)
                            .addComponent(stxtTelCli, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jpnPessoalClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblCelularCliente)
                            .addComponent(stxtCelCli, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jpnPessoalClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jpnPessoalClienteLayout.createSequentialGroup()
                                .addComponent(lblEmailCliente)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 438, Short.MAX_VALUE))
                            .addComponent(stxtEmailCli, javax.swing.GroupLayout.DEFAULT_SIZE, 471, Short.MAX_VALUE)))
                    .addGroup(jpnPessoalClienteLayout.createSequentialGroup()
                        .addGroup(jpnPessoalClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblNomeCliente)
                            .addComponent(stxtNomeCli, javax.swing.GroupLayout.PREFERRED_SIZE, 380, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jpnPessoalClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(stxtCpfCli, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblCpfCliente))
                        .addGap(18, 18, 18)
                        .addGroup(jpnPessoalClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(stxtRgCli, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblRgCliente))
                        .addGap(18, 18, 18)
                        .addGroup(jpnPessoalClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(stxtDataNascCli, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblDataNascCliente))
                        .addGap(6, 6, 6)))
                .addComponent(lblMensagemPessoal)
                .addContainerGap())
        );
        jpnPessoalClienteLayout.setVerticalGroup(
            jpnPessoalClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpnPessoalClienteLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jpnPessoalClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jpnPessoalClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jpnPessoalClienteLayout.createSequentialGroup()
                            .addComponent(lblNomeCliente)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(stxtNomeCli, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(jpnPessoalClienteLayout.createSequentialGroup()
                            .addComponent(lblDataNascCliente)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(stxtDataNascCli, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jpnPessoalClienteLayout.createSequentialGroup()
                        .addGroup(jpnPessoalClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(lblRgCliente)
                            .addComponent(lblCpfCliente))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jpnPessoalClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(stxtRgCli, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(stxtCpfCli, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 17, Short.MAX_VALUE)
                .addGroup(jpnPessoalClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblTelefoneCliente)
                    .addGroup(jpnPessoalClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addGroup(jpnPessoalClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jpnPessoalClienteLayout.createSequentialGroup()
                                .addComponent(lblCelularCliente)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jpnPessoalClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(stxtEmailCli, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(stxtCelCli, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addComponent(lblEmailCliente))
                        .addGroup(jpnPessoalClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(stxtTelCli, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblMensagemPessoal, javax.swing.GroupLayout.PREFERRED_SIZE, 12, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addGap(24, 24, 24))
        );

        jpnEnderecoCliente.setBackground(new java.awt.Color(255, 255, 255));
        jpnEnderecoCliente.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Endereço", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Arial", 1, 12))); // NOI18N

        lblCepCliente.setFont(new java.awt.Font("Arial", 1, 11));
        lblCepCliente.setText("CEP");

        lblEstadoCliente.setFont(new java.awt.Font("Arial", 1, 11));
        lblEstadoCliente.setText("Estado ");

        lblCidadeCliente.setFont(new java.awt.Font("Arial", 1, 11));
        lblCidadeCliente.setText("Cidade ");

        cbCidade.setModel(new javax.swing.DefaultComboBoxModel(new String[] {null}));
        cbCidade.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        cbCidade.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                cbCidadeItemStateChanged(evt);
            }
        });

        lblBairroCliente.setFont(new java.awt.Font("Arial", 1, 11));
        lblBairroCliente.setText("Bairro ");

        cbBairro.setModel(new javax.swing.DefaultComboBoxModel(new String[] {null}));
        cbBairro.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        cbBairro.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                cbBairroItemStateChanged(evt);
            }
        });

        lblRuaAvCliente.setFont(new java.awt.Font("Arial", 1, 11));
        lblRuaAvCliente.setText("Rua/Av.");

        cbEndereco.setModel(new javax.swing.DefaultComboBoxModel(new String[] {null}));
        cbEndereco.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        cbEndereco.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                cbEnderecoItemStateChanged(evt);
            }
        });

        lblNumeroCliente.setFont(new java.awt.Font("Arial", 1, 11));
        lblNumeroCliente.setText("Nº. ");

        ItxtNumCli.setFont(new java.awt.Font("Arial", 0, 12));
        ItxtNumCli.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));

        lblComplementoCliente.setFont(new java.awt.Font("Arial", 1, 11));
        lblComplementoCliente.setText("Complemento");

        cbEstado.setModel(new javax.swing.DefaultComboBoxModel(new String[] {}));
        cbEstado.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        cbEstado.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                cbEstadoItemStateChanged(evt);
            }
        });

        stxtApCli.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));

        stxtCompCli.setModel(new javax.swing.DefaultComboBoxModel(new String[] { null, "CASA", "APARTAMENTO"}));
        stxtCompCli.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        stxtCompCli.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                stxtCompCliActionPerformed(evt);
            }
        });

        cbCep.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        try {
            cbCep.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("##.###-###")));
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
        cbCep.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cbCepActionPerformed(evt);
            }
        });

        lblComplementoCliente1.setFont(new java.awt.Font("Arial", 1, 11));
        lblComplementoCliente1.setText("Apartamento");

        javax.swing.GroupLayout jpnEnderecoClienteLayout = new javax.swing.GroupLayout(jpnEnderecoCliente);
        jpnEnderecoCliente.setLayout(jpnEnderecoClienteLayout);
        jpnEnderecoClienteLayout.setHorizontalGroup(
            jpnEnderecoClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpnEnderecoClienteLayout.createSequentialGroup()
                .addGroup(jpnEnderecoClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jpnEnderecoClienteLayout.createSequentialGroup()
                        .addGap(644, 644, 644)
                        .addComponent(lblMensagemEndereco))
                    .addGroup(jpnEnderecoClienteLayout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jpnEnderecoClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jpnEnderecoClienteLayout.createSequentialGroup()
                                .addGroup(jpnEnderecoClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(cbEstado, javax.swing.GroupLayout.PREFERRED_SIZE, 142, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(lblEstadoCliente))
                                .addGap(18, 18, 18)
                                .addGroup(jpnEnderecoClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(lblCidadeCliente)
                                    .addComponent(cbCidade, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(18, 18, 18)
                                .addGroup(jpnEnderecoClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(jpnEnderecoClienteLayout.createSequentialGroup()
                                        .addComponent(lblBairroCliente)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
                                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jpnEnderecoClienteLayout.createSequentialGroup()
                                        .addGroup(jpnEnderecoClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                            .addComponent(cbBairro, 0, 249, Short.MAX_VALUE)
                                            .addGroup(jpnEnderecoClienteLayout.createSequentialGroup()
                                                .addGroup(jpnEnderecoClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                    .addComponent(ItxtNumCli, javax.swing.GroupLayout.PREFERRED_SIZE, 57, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                    .addComponent(lblNumeroCliente))
                                                .addGap(18, 18, 18)
                                                .addGroup(jpnEnderecoClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                    .addComponent(lblComplementoCliente)
                                                    .addComponent(stxtCompCli, javax.swing.GroupLayout.PREFERRED_SIZE, 136, javax.swing.GroupLayout.PREFERRED_SIZE))))
                                        .addGap(26, 26, 26))))
                            .addComponent(lblRuaAvCliente)
                            .addGroup(jpnEnderecoClienteLayout.createSequentialGroup()
                                .addComponent(cbEndereco, javax.swing.GroupLayout.PREFERRED_SIZE, 373, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
                        .addGroup(jpnEnderecoClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(jpnEnderecoClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(lblCepCliente)
                                .addComponent(cbCep, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jpnEnderecoClienteLayout.createSequentialGroup()
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jpnEnderecoClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(lblComplementoCliente1)
                                    .addComponent(stxtApCli, javax.swing.GroupLayout.DEFAULT_SIZE, 79, Short.MAX_VALUE))))))
                .addContainerGap())
        );
        jpnEnderecoClienteLayout.setVerticalGroup(
            jpnEnderecoClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpnEnderecoClienteLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jpnEnderecoClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jpnEnderecoClienteLayout.createSequentialGroup()
                        .addGroup(jpnEnderecoClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(jpnEnderecoClienteLayout.createSequentialGroup()
                                .addComponent(lblEstadoCliente)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(cbEstado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jpnEnderecoClienteLayout.createSequentialGroup()
                                .addComponent(lblCidadeCliente)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(cbCidade, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jpnEnderecoClienteLayout.createSequentialGroup()
                                .addComponent(lblBairroCliente)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(cbBairro, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jpnEnderecoClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jpnEnderecoClienteLayout.createSequentialGroup()
                                .addComponent(lblRuaAvCliente)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(cbEndereco, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jpnEnderecoClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addGroup(jpnEnderecoClienteLayout.createSequentialGroup()
                                    .addComponent(lblNumeroCliente)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(ItxtNumCli, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(jpnEnderecoClienteLayout.createSequentialGroup()
                                    .addComponent(lblComplementoCliente)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(stxtCompCli, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                    .addGroup(jpnEnderecoClienteLayout.createSequentialGroup()
                        .addComponent(lblCepCliente)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(cbCep, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 18, Short.MAX_VALUE)
                        .addComponent(lblComplementoCliente1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(stxtApCli, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 8, Short.MAX_VALUE)
                .addComponent(lblMensagemEndereco))
        );

        jpnTipoCliente.setBackground(new java.awt.Color(255, 255, 255));
        jpnTipoCliente.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Tipo Cliente", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Arial", 1, 12))); // NOI18N

        GrupoTipoCliente.add(StxtBomCli);
        StxtBomCli.setText("Bom");
        StxtBomCli.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                StxtBomCliActionPerformed(evt);
            }
        });

        GrupoTipoCliente.add(StxtRegCli);
        StxtRegCli.setText("Regular");
        StxtRegCli.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                StxtRegCliActionPerformed(evt);
            }
        });

        GrupoTipoCliente.add(stxtRuimCli);
        stxtRuimCli.setText("Ruim");
        stxtRuimCli.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                stxtRuimCliActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jpnTipoClienteLayout = new javax.swing.GroupLayout(jpnTipoCliente);
        jpnTipoCliente.setLayout(jpnTipoClienteLayout);
        jpnTipoClienteLayout.setHorizontalGroup(
            jpnTipoClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpnTipoClienteLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(StxtBomCli)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(StxtRegCli)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(stxtRuimCli)
                .addContainerGap(16, Short.MAX_VALUE))
        );
        jpnTipoClienteLayout.setVerticalGroup(
            jpnTipoClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpnTipoClienteLayout.createSequentialGroup()
                .addGap(29, 29, 29)
                .addGroup(jpnTipoClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(StxtBomCli)
                    .addComponent(StxtRegCli)
                    .addComponent(stxtRuimCli))
                .addContainerGap(42, Short.MAX_VALUE))
        );

        lblDataCliente.setFont(new java.awt.Font("Tahoma", 1, 11));
        lblDataCliente.setText("Data");

        txtDataCadastroCliente.setFont(new java.awt.Font("Arial", 0, 12));
        Date data = new Date(System.currentTimeMillis());
        SimpleDateFormat formatarDate = new SimpleDateFormat("dd/MM/yyyy");/*
        */
        txtDataCadastroCliente.setText(formatarDate.format(data));
        txtDataCadastroCliente.setEditable(false);
        txtDataCadastroCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtDataCadastroClienteActionPerformed(evt);
            }
        });

        btSalvarCli.setText("Salvar");
        btSalvarCli.setToolTipText("Salvar");
        btSalvarCli.setBorder(javax.swing.BorderFactory.createCompoundBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED), javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED)));
        btSalvarCli.setPreferredSize(new java.awt.Dimension(40, 30));
        btSalvarCli.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btSalvarCliActionPerformed(evt);
            }
        });

        btLimparCli.setText("Limpar");
        btLimparCli.setToolTipText("Limpar");
        btLimparCli.setBorder(javax.swing.BorderFactory.createCompoundBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED), javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED)));
        btLimparCli.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btLimparCliActionPerformed(evt);
            }
        });

        jPanel1.setBackground(new java.awt.Color(255, 255, 255));
        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Observação", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 11))); // NOI18N

        stxtObsCli.setColumns(20);
        stxtObsCli.setRows(5);
        stxtObsCli.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        jScrollPane1.setViewportView(stxtObsCli);

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 361, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 97, Short.MAX_VALUE)
                .addContainerGap())
        );

        jPanel45.setBackground(new java.awt.Color(255, 255, 255));
        jPanel45.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Cadastro de VeÍculo(s)", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Arial", 1, 12))); // NOI18N

        btCadasVeiCli.setText("Cadastrar Veiculos");
        btCadasVeiCli.setToolTipText("Incluir Veículo(s)");
        btCadasVeiCli.setBorder(javax.swing.BorderFactory.createCompoundBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED), javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED)));
        btCadasVeiCli.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btCadasVeiCliActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel45Layout = new javax.swing.GroupLayout(jPanel45);
        jPanel45.setLayout(jPanel45Layout);
        jPanel45Layout.setHorizontalGroup(
            jPanel45Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel45Layout.createSequentialGroup()
                .addGap(19, 19, 19)
                .addComponent(btCadasVeiCli)
                .addContainerGap(20, Short.MAX_VALUE))
        );
        jPanel45Layout.setVerticalGroup(
            jPanel45Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel45Layout.createSequentialGroup()
                .addGap(26, 26, 26)
                .addComponent(btCadasVeiCli)
                .addContainerGap(38, Short.MAX_VALUE))
        );

        jButton1.setText("Sair");
        jButton1.setToolTipText("Sair");
        jButton1.setBorder(javax.swing.BorderFactory.createCompoundBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED), javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED)));
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jButton2.setText("Novo");
        jButton2.setToolTipText("Novo");
        jButton2.setBorder(javax.swing.BorderFactory.createCompoundBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED), javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED)));
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jpnCadastroClienteLayout = new javax.swing.GroupLayout(jpnCadastroCliente);
        jpnCadastroCliente.setLayout(jpnCadastroClienteLayout);
        jpnCadastroClienteLayout.setHorizontalGroup(
            jpnCadastroClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpnCadastroClienteLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jpnCadastroClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jpnCadastroClienteLayout.createSequentialGroup()
                        .addComponent(lblDataCliente)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtDataCadastroCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jpnEnderecoCliente, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jpnPessoalCliente, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(jpnCadastroClienteLayout.createSequentialGroup()
                        .addGroup(jpnCadastroClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jpnCadastroClienteLayout.createSequentialGroup()
                                .addComponent(jpnTipoCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jPanel45, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jpnCadastroClienteLayout.createSequentialGroup()
                                .addComponent(btSalvarCli, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(btLimparCli)
                                .addGap(18, 18, 18)
                                .addComponent(jButton2)
                                .addGap(18, 18, 18)
                                .addComponent(jButton1)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addContainerGap())
        );

        jpnCadastroClienteLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {btLimparCli, btSalvarCli, jButton1, jButton2});

        jpnCadastroClienteLayout.setVerticalGroup(
            jpnCadastroClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpnCadastroClienteLayout.createSequentialGroup()
                .addGroup(jpnCadastroClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblDataCliente)
                    .addComponent(txtDataCadastroCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jpnPessoalCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jpnEnderecoCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(jpnCadastroClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jpnCadastroClienteLayout.createSequentialGroup()
                        .addGroup(jpnCadastroClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(jPanel45, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jpnTipoCliente, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addGap(18, 18, 18)
                        .addGroup(jpnCadastroClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(btSalvarCli, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(btLimparCli)
                            .addComponent(jButton2)
                            .addComponent(jButton1))))
                .addGap(34, 34, 34))
        );

        jpnCadastroClienteLayout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {btLimparCli, btSalvarCli, jButton1, jButton2});

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jpnCadastroCliente, javax.swing.GroupLayout.DEFAULT_SIZE, 776, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jpnCadastroCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 583, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(29, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-804)/2, (screenSize.height-627)/2, 804, 627);
    }// </editor-fold>//GEN-END:initComponents

    private void btSalvarCliActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btSalvarCliActionPerformed

        if (validar()) {//confirmando se a validação dos campos pelo metodo validação

            try {
                BD banco = new BD();

                String sql2 = "SELECT SQ_CLIENTE.NEXTVAL AS ID FROM DUAL ";
                ResultSet rs = banco.consultar(sql2);
                if (rs.next()) {
                    cli.setIdCliente(rs.getInt("ID"));
                }

                cli.setNomePessoa(stxtNomeCli.getText().trim().toUpperCase());
                cli.setCpfPessoa(stxtCpfCli.getText().trim().toLowerCase());
                cli.setRgPessoa(stxtRgCli.getText().trim().toUpperCase());
                cli.setDataNascPessoa(stxtDataNascCli.getText());
                cli.setTelPessoa(stxtTelCli.getText().trim().toUpperCase());
                cli.setCelPessoa(stxtCelCli.getText().trim().toUpperCase());
                cli.setEmailPessoa(stxtEmailCli.getText().trim().toUpperCase());

                Endereco itemEnd = (Endereco) cbEndereco.getSelectedItem();


                cli.setNumPessoa(Integer.parseInt(ItxtNumCli.getText()));
                cli.setComplementoPessoa((String) stxtCompCli.getSelectedItem());

                cli.setApartPessoa(stxtApCli.getText().trim().toUpperCase());
                cli.setObservacao(stxtObsCli.getText().trim().toUpperCase());
                cli.setTipoCliente(selTipo);

                String sql = "INSERT INTO CLIENTE (ID_CLIENTE,NOME_CLIENTE,CPF_CLIENTE,RG_CLIENTE,DATA_NASC_CLIENTE,TEL_CLIENTE,CEL_CLIENTE,EMAIL_CLIENTE,NUM_CLIENTE,COMPLEMENTO_CLIENTE,DATA_CADAS_CLIENTE,APART_CLIENTE,ID_ENDERECO,OBS_CLIENTE,TIPO_CLIENTE) values (?,?,?,?,TO_DATE('" + cli.getDataNascPessoa() + "','DD/MM/YYYY'),?,?,?,?,?,sysdate,?,?,?,?)";

                Object[] parametros = {cli.getIdCliente(), cli.getNomePessoa(), cli.getCpfPessoa(), cli.getRgPessoa(), cli.getTelPessoa(), cli.getCelPessoa(), cli.getEmailPessoa(), cli.getNumPessoa(), cli.getComplementoPessoa(), cli.getApartPessoa(), itemEnd.getIdEndereco(), cli.getObservacao(), cli.getTipoCliente()};
                Object[] tipos = {Integer.class, String.class, String.class, String.class, String.class, String.class, String.class, Integer.class, String.class, String.class, Integer.class, String.class, String.class};

                banco.executar(sql, parametros, tipos);

                btCadasVeiCli.setEnabled(true);

                ////////////////////////////////////////////////////////////////////////////////////////////
                stxtNomeCli.setEnabled(false);
                stxtCpfCli.setEnabled(false);
                stxtRgCli.setEnabled(false);
                stxtDataNascCli.setEnabled(false);
                stxtTelCli.setEnabled(false);
                stxtCelCli.setEnabled(false);
                stxtEmailCli.setEnabled(false);
                cbEstado.setEnabled(false);
                cbCidade.setEnabled(false);
                cbBairro.setEnabled(false);
                cbEndereco.setEnabled(false);
                ItxtNumCli.setEnabled(false);
                stxtCompCli.setEnabled(false);
                stxtApCli.setEnabled(false);
                StxtBomCli.setEnabled(false);
                StxtRegCli.setEnabled(false);
                stxtRuimCli.setEnabled(false);
                stxtObsCli.setEnabled(false);
                btSalvarCli.setEnabled(false);
                btLimparCli.setEnabled(false);
                JOptionPane.showMessageDialog(frameI, "Cadastro salvo com Sucesso");
            } catch (Exception ex) {
                ex.printStackTrace();

            }

        }
}//GEN-LAST:event_btSalvarCliActionPerformed

    private void txtDataCadastroClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtDataCadastroClienteActionPerformed
}//GEN-LAST:event_txtDataCadastroClienteActionPerformed

    private void btCadasVeiCliActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btCadasVeiCliActionPerformed
        // TODO add your handling code here:
        CadastroVeiculo veiculo = new CadastroVeiculo();
        veiculo.inicializarPF(cli.getNomePessoa(), cli.getIdCliente());
        veiculo.setVisible(true);
        

    }//GEN-LAST:event_btCadasVeiCliActionPerformed

    private void cbEstadoItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cbEstadoItemStateChanged
        try {

            String sql;
            cbCidade.removeAllItems(); // limpa a caixa de cidades atual.

            if (cbEstado.getSelectedItem() != null) {
                Estado itemEst = (Estado) cbEstado.getSelectedItem();
                sql = "Select * from cidade where id_uf = '" + itemEst.getIdUf() + "' order by NOME_CIDADE";


                BD bd = new BD();
                ResultSet r = bd.consultar(sql);

                Cidade cidade1 = new Cidade();
                cbCidade.addItem(cidade1);
                while (r.next()) {
                    Cidade cidade = new Cidade();


                    cidade.setIdCidade(r.getInt("id_cidade"));

                    String nomeCid = r.getString("NOME_CIDADE");
                    cidade.setNomeCidade(nomeCid);


                    cbCidade.addItem(cidade);
                }
            }
        } catch (ClassNotFoundException ex) {
        } catch (SQLException ex) {
        }


    }//GEN-LAST:event_cbEstadoItemStateChanged

    private void cbCidadeItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cbCidadeItemStateChanged
        try {

            String sql;
            cbBairro.removeAllItems(); // limpa a caixa de cidades atual.
            if (cbCidade.getSelectedItem() != null) {
                Cidade itemcid = (Cidade) cbCidade.getSelectedItem();

                sql = "Select * from bairro where id_cidade = " + itemcid.getIdCidade() + " order by NOME_BAIRRO";


                BD bd = new BD();
                ResultSet r = bd.consultar(sql);

                Bairro bairro1 = new Bairro();
                cbBairro.addItem(bairro1);
                while (r.next()) {

                    Bairro bairro = new Bairro();

                    bairro.setIdBairro(r.getInt("id_bairro"));

                    String nomeBair = r.getString("NOME_BAIRRO");
                    bairro.setNomeBairro(nomeBair);


                    cbBairro.addItem(bairro);
                }
            }
        } catch (ClassNotFoundException ex) {
        } catch (SQLException ex) {
        }


    }//GEN-LAST:event_cbCidadeItemStateChanged

    private void cbBairroItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cbBairroItemStateChanged

        try {

            String sql;
            cbEndereco.removeAllItems(); // limpa a caixa de cidades atual.
            if (cbBairro.getSelectedItem() != null) {
                Bairro itemBai = (Bairro) cbBairro.getSelectedItem();

                sql = "Select * from endereco where id_bairro = " + itemBai.getIdBairro() + "order by NOME_ENDERECO";


                BD bd = new BD();
                ResultSet r = bd.consultar(sql);

                Endereco end1 = new Endereco();
                cbEndereco.addItem(end1);

                while (r.next()) {


                    Endereco end = new Endereco();

                    end.setIdEndereco(r.getInt("id_endereco"));

                    end.setNomeEndereco(r.getString("NOME_ENDERECO"));

                    end.setCepEndereco(r.getString("cep"));

                    cbEndereco.addItem(end);
                }
            }
        } catch (ClassNotFoundException ex) {
        } catch (SQLException ex) {
        }

    }//GEN-LAST:event_cbBairroItemStateChanged

    private void cbEnderecoItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cbEnderecoItemStateChanged

        if (cbEndereco.getSelectedItem() != null) {
            Endereco itemEnd = (Endereco) cbEndereco.getSelectedItem();

            cbCep.setText(itemEnd.getCepEndereco());
            cbCep.setEnabled(false);
        }

    }//GEN-LAST:event_cbEnderecoItemStateChanged

    private void StxtBomCliActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_StxtBomCliActionPerformed

        Cliente cliente = new Cliente();
        if (StxtBomCli.isSelected()) {
            selTipo = "Bom";
            cliente.setTipoCliente(selTipo);
        }

    }//GEN-LAST:event_StxtBomCliActionPerformed

    private void StxtRegCliActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_StxtRegCliActionPerformed

        Cliente cliente = new Cliente();
        if (StxtRegCli.isSelected()) {
            selTipo = "Regular";
            cliente.setTipoCliente(selTipo);
        }

    }//GEN-LAST:event_StxtRegCliActionPerformed

    private void stxtRuimCliActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_stxtRuimCliActionPerformed

        Cliente cliente = new Cliente();
        if (stxtRuimCli.isSelected()) {
            selTipo = "Ruim";
            cliente.setTipoCliente(selTipo);
        }
    }//GEN-LAST:event_stxtRuimCliActionPerformed

    private void btLimparCliActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btLimparCliActionPerformed

        this.dispose();
        try {
            CadastroCliente cl = new CadastroCliente();
            cl.setVisible(true);

        } catch (SQLException ex) {
            Logger.getLogger(CadastroCliente.class.getName()).log(Level.SEVERE, null, ex);
        }


    }//GEN-LAST:event_btLimparCliActionPerformed

    private void stxtCpfCliActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_stxtCpfCliActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_stxtCpfCliActionPerformed

    private void stxtCompCliActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_stxtCompCliActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_stxtCompCliActionPerformed

    private void cbCepActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbCepActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_cbCepActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        this.dispose();
    }//GEN-LAST:event_jButton1ActionPerformed

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed

        this.dispose();
        try {
            CadastroCliente cl = new CadastroCliente();
            cl.setVisible(true);

        } catch (SQLException ex) {
            Logger.getLogger(CadastroCliente.class.getName()).log(Level.SEVERE, null, ex);
        }

    }//GEN-LAST:event_jButton2ActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                try {
                    new CadastroCliente().setVisible(true);
                } catch (SQLException ex) {
                    Logger.getLogger(CadastroCliente.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup GrupoTipoCliente;
    private javax.swing.JTextField ItxtNumCli;
    private javax.swing.JRadioButton StxtBomCli;
    private javax.swing.JRadioButton StxtRegCli;
    private javax.swing.JButton btCadasVeiCli;
    private javax.swing.JButton btLimparCli;
    private javax.swing.JButton btSalvarCli;
    private javax.swing.JComboBox cbBairro;
    private javax.swing.JFormattedTextField cbCep;
    private javax.swing.JComboBox cbCidade;
    private javax.swing.JComboBox cbEndereco;
    private javax.swing.JComboBox cbEstado;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel45;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JPanel jpnCadastroCliente;
    private javax.swing.JPanel jpnEnderecoCliente;
    private javax.swing.JPanel jpnPessoalCliente;
    private javax.swing.JPanel jpnTipoCliente;
    private javax.swing.JLabel lblBairroCliente;
    private javax.swing.JLabel lblCelularCliente;
    private javax.swing.JLabel lblCepCliente;
    private javax.swing.JLabel lblCidadeCliente;
    private javax.swing.JLabel lblComplementoCliente;
    private javax.swing.JLabel lblComplementoCliente1;
    private javax.swing.JLabel lblCpfCliente;
    private javax.swing.JLabel lblDataCliente;
    private javax.swing.JLabel lblDataNascCliente;
    private javax.swing.JLabel lblEmailCliente;
    private javax.swing.JLabel lblEstadoCliente;
    private javax.swing.JLabel lblMensagemEndereco;
    private javax.swing.JLabel lblMensagemPessoal;
    private javax.swing.JLabel lblNomeCliente;
    private javax.swing.JLabel lblNumeroCliente;
    private javax.swing.JLabel lblRgCliente;
    private javax.swing.JLabel lblRuaAvCliente;
    private javax.swing.JLabel lblTelefoneCliente;
    private javax.swing.JTextField stxtApCli;
    private javax.swing.JFormattedTextField stxtCelCli;
    private javax.swing.JComboBox stxtCompCli;
    private javax.swing.JFormattedTextField stxtCpfCli;
    private javax.swing.JFormattedTextField stxtDataNascCli;
    private javax.swing.JTextField stxtEmailCli;
    private javax.swing.JTextField stxtNomeCli;
    private javax.swing.JTextArea stxtObsCli;
    private javax.swing.JTextField stxtRgCli;
    private javax.swing.JRadioButton stxtRuimCli;
    private javax.swing.JFormattedTextField stxtTelCli;
    private javax.swing.JTextField txtDataCadastroCliente;
    // End of variables declaration//GEN-END:variables

    private void iniciar() {

        btCadasVeiCli.setEnabled(false);// desabilitando o botão cadastrar veiculos obs: ele sera habilitado no botao salvar

        try {
            String sql = "Select * from estado order by id_uf";
            BD bd = new BD();
            ResultSet r1 = bd.consultar(sql);
            Estado est = new Estado();
            cbEstado.addItem(est);

            while (r1.next()) {
                Estado estado = new Estado();
                String sigla = r1.getString("id_uf");
                // preenchendo informacoes do objeto
                estado.setIdUf(sigla);
                // e.setId(r1.getInt("id");
                cbEstado.addItem(estado);
            }



        } catch (ClassNotFoundException ex) {
        } catch (SQLException ex) {
        }
    }

    public boolean validar() {
        boolean Resultado = true;
        //////////////////////////////////////////////////////////////////  

        if (validarObservacao(stxtObsCli.getText()) == false) {
            Resultado = false;
        } else if (validarNome(stxtNomeCli.getText()) == false) {
            Resultado = false;
        } else if (validarCpf(stxtCpfCli.getText()) == false) {
            Resultado = false;
        } else if (validarRG(stxtRgCli.getText()) == false) {
            Resultado = false;
        } else if (validarData(stxtDataNascCli.getText()) == false) {
            Resultado = false;
        } else if (validarTelefone(stxtTelCli.getText()) == false) {
            Resultado = false;
        } else if (validarTelefone(stxtCelCli.getText()) == false) {
            Resultado = false;
        } else if (validarEmail(stxtEmailCli.getText()) == false) {
            Resultado = false;
        } else if (cbCep.getText().trim().equals(".   -")) {
            Resultado = false;
            JOptionPane.showMessageDialog(frameI, "O preenchimento do campo Endereço é obrigatório!");
        } else if (validarNumero(ItxtNumCli.getText()) == false) {
            Resultado = false;
        } else if (stxtCompCli.getSelectedItem() == null) {
            Resultado = false;
            JOptionPane.showMessageDialog(frameI, "O preenchimento do campo Complemento é obrigatório");
        } else if (stxtApCli.getText().trim().length() > 0) {
            Resultado = validarSalaApart(stxtApCli.getText());
        }





        return Resultado;
    }
}
